<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
class Page_model extends AppModel{
    var $_tablename = PAGE;
    var $_primary_key = PAGE_PAGE_ID;
	var $_title_key = PAGE_TITLE;
    var $_mapping = array(
                           array('id' => PAGE_PAGE_ID),
                           array('admin_id' => PAGE_FRANCHISE_ID),
                           array('title' => PAGE_TITLE),
                           array('css_file' => PAGE_CSS_FILE),
                           array('iframe' => PAGE_IFRAME),
						   array('visible' => PAGE_VISIBLE),
						   array('active' => PAGE_ACTIVE),
						   array('content_middle' => PAGE_CONTENT_MIDDLE),
						   array('meta_title' => PAGE_META_TITLE),
						   array('meta_description' => PAGE_META_DESCRIPTION),
						   array('meta_keywords' => PAGE_META_KEYWORD),
						   array('content_left' => PAGE_CONTENT_LEFT),
						   array('content_right' => PAGE_CONTENT_RIGHT),
						   array('show_flag' => PAGE_SHOW_FLAG)

                            );
    function Page_model(){
        parent::AppModel();
    }
	function get_by_pname($name){
        $this->db->where($this->_title_key, $name);
        $res = $this->db->get($this->_tablename);
       
        if($res->num_rows() > 0){
            $row = $res->row_array();
            $this->_field_mapping($row);
            return  TRUE;
        }else{
            return FALSE;
        }
        return TRUE;
    }
}


